package com.linskating.wheat.common;

import lombok.Data;

import java.io.Serial;
import java.io.Serializable;

@Data
public class BaseResponse<T> implements Serializable {

    @Serial
    private static final long serialVersionUID = 3727836367552178806L;

    private int code;
    private T data;
    private String message;
    private String description;

    public BaseResponse(int code, T date, String message, String description) {
        this.code = code;
        this.data = date;
        this.message = message;
        this.description = description;
    }

    public BaseResponse(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public BaseResponse(int code, T date, String message) {
        this.code = code;
        this.data = date;
        this.message = message;
    }

    public BaseResponse(ErrorCode errorCode, String description) {
        this(errorCode.getCode(), null, errorCode.getMessage(), description);
    }
}
